home *** CD-ROM | disk | FTP | other *** search
- { control.pas -- Demonstrate how to use control objects }
-
- program Control;
-
- uses WinTypes, WinProcs, WObjects, Strings;
-
- type
-
- ControlApplication = object(TApplication)
- procedure InitMainWindow; virtual;
- end;
-
- PControlWindow = ^ControlWindow;
- ControlWindow = object(TWindow)
- OkButton: PButton;
- constructor Init(AParent: PWindowsObject; ATitle: PChar);
- procedure SetupWindow; virtual;
- procedure IDOk(var Msg: TMessage);
- virtual id_First + id_Ok;
- end;
-
-
- { ControlApplication }
-
- {- Initialize ControlApplication object's window }
- procedure ControlApplication.InitMainWindow;
- begin
- MainWindow := New(PControlWindow, Init(nil, 'Control'))
- end;
-
-
- { ControlWindow }
-
- {- Construct ControlWindow object }
- constructor ControlWindow.Init(AParent: PWindowsObject; ATitle: PChar);
- begin
- TWindow.Init(AParent, ATitle);
- EnableKBHandler;
- with Attr do
- begin
- X := 0; Y := 0; W := 500; H := 350
- end;
- OkButton := New(PButton, Init(@Self, id_Ok, 'Ok',
- 390, 280, 80, 30, true));
- end;
-
- {- Perform jobs requiring an initialized window handle }
- procedure ControlWindow.SetupWindow;
- begin
- TWindow.SetupWindow;
- SetFocus(OkButton^.HWindow);
- end;
-
- {- Respond to selection of Ok button }
- procedure ControlWindow.IDOk(var Msg: TMessage);
- begin
- CloseWindow
- end;
-
- var
-
- ControlApp: ControlApplication;
-
- begin
- ControlApp.Init('ControlApp');
- ControlApp.Run;
- ControlApp.Done
- end.
-
-
- {--------------------------------------------------------------
- Copyright (c) 1991 by Tom Swan. All rights reserved.
- Revision 1.00 Date: 5/9/1991
- ---------------------------------------------------------------}
-